//
//  HLLMyselfViewController.m
//  PhotoHLL
//
//  Created by mac on 2017/9/19.
//  Copyright © 2017年 yangweiwei. All rights reserved.
//

#import "HLLMyselfViewController.h"
#import "HLLMyTableViewCell.h"
@interface HLLMyselfViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) HLLNavView *navView;
@property (nonatomic, strong) UITableView *tableView0;
@property (nonatomic, strong) NSArray *nameArr;
@end

@implementation HLLMyselfViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.nameArr = @[ @{@"img":@"buy_coin",@"name":@"充值"},
                      @{@"img":@"shopcart",@"name":@"已购买"},
                      @{@"img":@"collect",@"name":@"我的收藏"},
                      @{@"img":@"vip",@"name":@"VIP专区"},
                      @{@"img":@"task",@"name":@"每日任务"},
                      @{@"img":@"msg",@"name":@"消息"},
                      @{@"img":@"share",@"name":@"分享"},
                      @{@"img":@"setting",@"name":@"设置"}];
    self.navView = [[HLLNavView alloc] initWithFrame:CGRectMake(0, 0, KWidth, 64)];
    [self.navView normalNavView];
    [self.view addSubview:self.navView];
    [self.view addSubview:self.tableView0];
    // Do any additional setup after loading the view.
}
- (UITableView *)tableView0{

    if (!_tableView0) {
        _tableView0 = [[UITableView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.navView.frame), KWidth, KHeight - 64-55)];
        _tableView0.delegate = self;
        _tableView0.dataSource = self;
    }
    return _tableView0;
}
#pragma mark --delegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{

    return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (section == 0) {
        return 1;
    }
    return self.nameArr.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

    if (indexPath.section == 0) {
        return 200;
    }
    return 60;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    if (indexPath.section == 0) {
        static NSString *MyID = @"mysection";
        HLLMyTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyID];
        if (!cell) {
            cell = [[NSBundle mainBundle] loadNibNamed:@"MySection" owner:self options:nil].firstObject;
        }
        
        return cell;

    } else {
        static NSString *MyID = @"my";
        HLLMyTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyID];
        if (!cell) {
            cell = [[NSBundle mainBundle] loadNibNamed:@"MyCell" owner:self options:nil].firstObject;
        }
        
        
        cell.leftImageView.image = ImageNamed(self.nameArr[indexPath.row][@"img"]);
        cell.namelab.text = self.nameArr[indexPath.row][@"name"];
        return cell;
    }
    return nil;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
